import 'package:flutter/material.dart';

class AppBarCustom extends StatefulWidget {
  AppBarCustom({Key key}) : super(key: key);

  @override
  _AppBarCustomState createState() => _AppBarCustomState();
}

class _AppBarCustomState extends State<AppBarCustom> {
  @override
  Widget build(BuildContext context) {
    return DefaultTabController(
        length: 2,
        child: Scaffold(
          appBar: AppBar(
            centerTitle: true,
            title: Text("自定义AppBar"),
            // leading: IconButton(
            //     icon: Icon(Icons.menu),
            //     onPressed: () {
            //       print("点击menu");
            //     }),
            // actions: <Widget>[
            //   IconButton(
            //       icon: Icon(Icons.settings),
            //       onPressed: () {
            //         print("点击settings");
            //       }),
            //   IconButton(
            //       icon: Icon(Icons.search),
            //       onPressed: () {
            //         print("点击search");
            //       }),
            // ],
            bottom: TabBar(
              tabs: <Widget>[Tab(text: "热门"), Tab(text: "关注")],
            ),
          ),
          body: TabBarView(
            children: <Widget>[
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text("热门"),
                  ),
                  ListTile(
                    title: Text("热门"),
                  ),
                  ListTile(
                    title: Text("热门"),
                  ),
                  ListTile(
                    title: Text("热门"),
                  ),
                  ListTile(
                    title: Text("热门"),
                  )
                ],
              ),
              ListView(
                children: <Widget>[
                  ListTile(
                    title: Text("关注"),
                  ),
                  ListTile(
                    title: Text("关注"),
                  ),
                  ListTile(
                    title: Text("关注"),
                  ),
                  ListTile(
                    title: Text("关注"),
                  ),
                  ListTile(
                    title: Text("关注"),
                  )
                ],
              )
            ],
          ),
        ));
  }
}
